using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Text;
using DuMez.DAL;
using DuMez.BL;

public class Mezun : IDisposable
{
    #region Fields

    private int _MezunId;
    private string _Ad;
    private string _Soyad;
    private DateTime _DogumTarihi;
    private int _MezunTipId;
    private string _Email;
    private string _Password;
    private string _Telefon;
    private string _GSM_1;
    private string _GSM_2;
    private string _Adres;
    private bool _OnaylandiMi;
    private int _SehirId;
    private int _ResimId;



    #endregion

    #region Properties

    public int MezunId
    {
        get { return _MezunId; }
        set { _MezunId = value; }
    }

    public string Ad
    {
        get { return _Ad; }
        set { _Ad = value; }
    }

    public string Soyad
    {
        get { return _Soyad; }
        set { _Soyad = value; }
    }

    public DateTime DogumTarihi
    {
        get { return _DogumTarihi; }
        set { _DogumTarihi = value; }
    }

    public int MezunTipId
    {
        get { return _MezunTipId; }
        set { _MezunTipId = value; }
    }

    public string Email
    {
        get { return _Email; }
        set { _Email = value; }
    }

    public string Password
    {
        get { return _Password; }
        set { _Password = value; }
    }

    public string Telefon
    {
        get { return _Telefon; }
        set { _Telefon = value; }
    }

    public string GSM_1
    {
        get { return _GSM_1; }
        set { _GSM_1 = value; }
    }

    public string GSM_2
    {
        get { return _GSM_2; }
        set { _GSM_2 = value; }
    }


    public string Adres
    {
        get { return _Adres; }
        set { _Adres = value; }
    }

    public bool OnaylandiMi
    {
        get { return _OnaylandiMi; }
        set { _OnaylandiMi = value; }
    }

    public int SehirId
    {
        get { return _SehirId; }
        set { _SehirId = value; }
    }
    public int ResimId
    {
        get { return _ResimId; }
        set { _ResimId = value; }
    }


    #endregion

    #region Constructor

    public Mezun()
    {
    }


    #endregion

    #region IDisposable Members
    public void Dispose()
    {

    }
    #endregion

    #region Methods

    string con = Parameters.GetConnection();
    public static void MezunEkle(Mezun mezun)
    {
        try
        {
            SqlUtility.ExecuteNonQuery("dbo.MEZUN_EKLE '" + mezun.Ad + "','" + mezun.Soyad + "'," + mezun.MezunTipId + ",'" + mezun.Email + "','" + mezun.Password + "','" + mezun.OnaylandiMi + "'");
        }
        catch (Exception)
        {

            throw;
        }
    }

    public static void MezunSil(Mezun mezun)
    {
        try
        {
            SqlUtility.ExecuteNonQuery("dbo.MEZUN_SIL " + mezun.MezunId + "");
        }
        catch (Exception)
        {

            throw;
        }
    }

    public static void MezunBilgiGuncelle(Mezun mezun)
    {
        try
        {
            SqlUtility.ExecuteNonQuery("dbo.MEZUN_BILGI_GUNCELLE '" + mezun.Ad + "','" + mezun.Soyad + "'," + mezun.MezunTipId + ",'" + mezun.Email + "','" + mezun.Password + "','" + mezun.Telefon + "','" + mezun.GSM_1 + "','" + mezun.GSM_2 + "','" + mezun.Adres + "','" + mezun.SehirId + "','" + mezun.ResimId + "','" + mezun.MezunId + "'");
        }
        catch (Exception)
        {

            throw;
        }
    }

    public static DataTable GetAll()
    {
        return SqlUtility.ExecuteDataTable("SELECT * FROM  Mezun");
    }

    public static DataRow GetSpecificMezun(int MezunID)
    {
        return SqlUtility.ExecuteDataRow("dbo.DUMEZ_MEZUN_SPECIFIC_GETIR " + MezunID + "");
    }

    public static DataTable MezunCalisanGetAll()
    {
        return SqlUtility.ExecuteDataTable("dbo.DUMEZ_MEZUN_CALISAN_SELECT");
    }

    public static DataTable MezunOkuyanGetAll()
    {
        return SqlUtility.ExecuteDataTable("dbo.DUMEZ_MEZUN_OKUYAN_SELECT");
    }

    public static DataTable MezunSon10Kayit()
    {
        return SqlUtility.ExecuteDataTable("dbo.DUMEZ_MEZUN_SON10_KAYIT_SELECT");
    }

    public static DataTable MezunOnayBekliyor()
    {
        return SqlUtility.ExecuteDataTable("dbo.DUMEZ_MEZUN_ONAY_BEKLIYOR");
    }

    public static DataTable GirisKontrol(string Email, string Password)
    {
        return SqlUtility.ExecuteDataTable("Exec dbo.DuMez_GirisKontrol '" + Email + "','" + Password + "'");
    }



    #endregion
}
